<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>欢迎光临 Music Store</title>
<link type="text/css" rel="Stylesheet"
	href="${pageContext.request.contextPath }/style/front.css" />
<script src="${pageContext.request.contextPath}/script/jquery-1.10.2.js"></script>
<script>
	$(function() {
		$("#confirm").click(function() {
			window.location.href = "order";
		});
	});
</script>
<style>
#main thead {
	font-weight: bold;
}

#main table {
	text-align: center;
	margin: 10px 40px;
}

#main td {
	width: 80px;
	background-color: #f4f4f4;
	padding: 2px 0px;
}

#main .sp {
	width: 200px;
}

#confirm {
	margin: 0px 40px;
}
</style>
</head>
<body>
	<div id="wrapper">
		<s:action name="header" executeResult="true" namespace="/"></s:action>
		<div id="content">
			<s:action name="sidebar" executeResult="true" namespace="/"></s:action>
			<div id="main">
				<h3 id="main-title">购物车</h3>
				<c:if test="${not empty cart }">
					<table>
						<thead>
							<tr>
								<td class="sp">唱片</td>
								<td>单价</td>
								<td>数量</td>
								<td>小计</td>
								<td>删除</td>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${cart.items }" var="i">
								<tr>
									<td class="sp">${i.title }</td>
									<td>${i.unitPrice }</td>
									<td>${i.quantity }</td>
									<td>${i.getSubTotal() }</td>
									<td><a href="removeCart?albumId=${i.albumId}">删除</a></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<input type="button" id="confirm" value="订单确认" />
				</c:if>
				<c:if test="${empty cart }">
					<p style="text-indent: 2em;">您的购物车是空的。</p>
				</c:if>

			</div>
			<div class="clearBoth"></div>
		</div>
		<%@ include file="../shared/footer.jsp"%>
	</div>
</body>
</html>
